const { Sequelize } = require('sequelize');
// 方法 2: 分别传递参数 (其它数据库)
const sqlconfig = require('./config');
const { localhost, database, user, password } = sqlconfig;
const sequelize = new Sequelize(database, user, password, {
    host: localhost,
    /* 选择 'mysql' | 'mariadb' | 'postgres' | 'mssql' 其一 */
    dialectOptions: {
        dateStrings: true,
        typeCast: true
    },
    dialect: 'mysql',
    timezone: '+08:00'
});
try {
    sequelize.authenticate();
    console.log('数据库链接成功！');
  } catch (error) {
    console.error('数据连接失败！:', error);
  }
module.exports = sequelize;

